﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Topics_Topics_del : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int tid =int.Parse( Request["tid"]);
        CMSModel.CMSEntities dal = DAL.DBManager.GetCmsEmtity();
        var c = dal.Topics2.First(x => x.Id ==tid );
        try
        {
            dal.DeleteObject(c);
            dal.SaveChanges();
            ClientScript.RegisterStartupScript(GetType(), "delete", "alert('删除成功!'),document.location='Topics.aspx'", true);
        }
        catch (Exception ex)
        {

            LogYuMin.LogWriter.GetWriter(LogYuMin.LogFile.error).Write(GetType(), "DeleteTopics", LogYuMin.LogStates.ERROR, ex);
            ClientScript.RegisterStartupScript(GetType(), "delete", "alert('删除失败!')", true);
        }
    }
}